package com.tom.commonframework.common.net.downloads.entity;

import android.os.Parcel;
import android.os.Parcelable;

/**
 * Created by TomLeisen on 2018/7/16
 * Email: xy162162a@163.com
 * Description:上传/下载实体类--进度转换实体类
 */
public class DownloadEntity implements Parcelable {

    private int progress;//进度  Max = 100%
    private long currentFileSize;//当前的文件大小  如：200
    private long totalFileSize;//总文件大小      如：8192
    private String currentFileSizeStr;//当前的文件大小  如：0/MB
    private String totalFileSizeStr;//总文件大小       如：24/MB

    public int getProgress() {
        return progress;
    }

    public void setProgress(int progress) {
        this.progress = progress;
    }

    public long getCurrentFileSize() {
        return currentFileSize;
    }

    public void setCurrentFileSize(long currentFileSize) {
        this.currentFileSize = currentFileSize;
    }

    public long getTotalFileSize() {
        return totalFileSize;
    }

    public void setTotalFileSize(long totalFileSize) {
        this.totalFileSize = totalFileSize;
    }


    public String getCurrentFileSizeStr() {
        return currentFileSizeStr;
    }

    public void setCurrentFileSizeStr(String currentFileSizeStr) {
        this.currentFileSizeStr = currentFileSizeStr;
    }

    public String getTotalFileSizeStr() {
        return totalFileSizeStr;
    }

    public void setTotalFileSizeStr(String totalFileSizeStr) {
        this.totalFileSizeStr = totalFileSizeStr;
    }

    @Override
    public int describeContents() {
        return 0;
    }

    @Override
    public void writeToParcel(Parcel dest, int flags) {
        dest.writeInt(this.progress);
        dest.writeLong(this.currentFileSize);
        dest.writeLong(this.totalFileSize);
        dest.writeString(this.totalFileSizeStr);
        dest.writeString(this.currentFileSizeStr);
    }

    public DownloadEntity() {
    }

    protected DownloadEntity(Parcel in) {
        this.progress = in.readInt();
        this.currentFileSize = in.readLong();
        this.totalFileSize = in.readLong();
        this.totalFileSizeStr = in.readString();
        this.currentFileSizeStr = in.readString();
    }

    public static final Creator<DownloadEntity> CREATOR = new Creator<DownloadEntity>() {
        @Override
        public DownloadEntity createFromParcel(Parcel source) {
            return new DownloadEntity(source);
        }

        @Override
        public DownloadEntity[] newArray(int size) {
            return new DownloadEntity[size];
        }
    };
}
